package com.mr.web;

import com.b2c.common.utils.PageResult;
import com.mr.bo.SearchPageBo;
import com.mr.pojo.Goods;
import com.mr.service.GoodsIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName SearchGoodsController
 * @Description: TODO
 * @Author kun
 * @Date 2020/8/11
 * @Version V1.0
 **/
@RestController
@RequestMapping("goods")
public class SearchGoodsController {

    @Autowired
    private GoodsIndexService goodIndexService;
    //查询商品分页
    @PostMapping("page")
    public ResponseEntity<PageResult<Goods>> goodsPage(@RequestBody SearchPageBo searchPage){

        System.out.println(searchPage.getKey());
        return ResponseEntity.ok(goodIndexService.queryGoodsPage(searchPage));
    }
}

